//
//  SectionView.m
//  time
//
//  Created by bingo on 2018/5/20.
//  Copyright © 2018年 1ge. All rights reserved.
//

#import "SectionView.h"
#import <Masonry/Masonry.h>

@interface SectionView ()


@end

@implementation SectionView

- (instancetype)initWithFrame:(CGRect)frame {
    if (self = [super initWithFrame:frame]) {
        [self setupUI];
        [self setupLayout];
    }
    return self;
}

- (void)setupUI {
    self.backgroundColor = [UIColor whiteColor];
    self.titleLabel = [[UILabel alloc] init];
    self.titleLabel.text = @"热门文章";
    self.titleLabel.textColor = [UIColor blueColor];
    
    self.detailLabel = [[UILabel alloc] init];
    self.detailLabel.text = @"更多";
    self.detailLabel.hidden = YES;
    self.detailLabel.textAlignment = NSTextAlignmentRight;
}
- (void)setupLayout {

    [self addSubview:self.detailLabel];
    [self.detailLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.right.offset = -10;
        make.centerY.mas_equalTo(self);
    }];
    
    [self addSubview:self.titleLabel];
    [self.titleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(10);
        make.centerY.mas_equalTo(self);
        make.right.mas_equalTo(self.detailLabel.mas_left);
    }];
    
}
/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect {
    // Drawing code
}
*/

@end
